package fr.insee.solr.model.param;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;




public class SolrRequestParam {
	
	private String q;
	
	private Integer start = 0;
	
	private Integer rows = 100;
	
	private List<SolrFacetParams> facetsField = new ArrayList<SolrFacetParams>();
	
	private Map<String, String> filters = new HashMap<String, String>();
	
	private DefType defType;
	
	
	
	public void addFacetField(SolrFacetParams f){
		this.facetsField.add(f);
	}
	
	public void addFilter(String field,String restriction){
		this.filters.put(field, restriction);
	}

	public String getQ() {
		return q;
	}

	public void setQ(String q) {
		this.q = q;
	}

	public Integer getStart() {
		return start;
	}

	public void setStart(Integer start) {
		this.start = start;
	}

	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}


	public Map<String, String> getFilters() {
		return filters;
	}

	public void setFilters(Map<String, String> filters) {
		this.filters = filters;
	}

	public List<SolrFacetParams> getFacetsField() {
		return facetsField;
	}

	public void setFacetsField(List<SolrFacetParams> facetsField) {
		this.facetsField = facetsField;
	}

	public DefType getDefType() {
		return defType;
	}

	public void setDefType(DefType defType) {
		this.defType = defType;
	}

	public enum DefType{
		dismax,edismax,defaultQp;
	}
	
	
	
	public static class Param{
		private String name;
		private String value;
		
		public Param(String name, String value) {
			this.name = name;
			this.value = value;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getValue() {
			return value;
		}
		public void setValue(String value) {
			this.value = value;
		}
		
		
	}
}
